home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / asm_msc1.arc / SCRSUB.ASM < prev    next >
Assembly Source File  |  1988-11-20  |  2KB  |  76 lines

  1. ; SCRSUB - screen display subroutine for compiled BASIC
  2. ; Copyright 1983 Data Base Decisions
  3. ; CALL SCRSUB(LIN$,ROW%,COL%,COLR%)
  4. ; LIN$ is the line to be displayed - can be up to 2000 characters
  5. ; ROW% is the row where LIN$ is to start (1-25)
  6. ; COL% is the column where LIN$ is to start (1-80)
  7. ; COLR% is the color attribute to be used (see appendix C of Tech Reference)
  8.  
  9. skip    equ 2            ; 1 for interpretive, 2 for compiled
  10.  
  11. cseg    segment para public 'code'
  12. public    scrsub
  13. scrsub proc far
  14.     assume cs:cseg,ds:nothing,ss:nothing,es:nothing
  15.     push bp
  16.     mov bp,sp
  17.     push es
  18.     mov si,[bp+10]        ; get row
  19.     mov ax,[si]
  20.     dec ax            ; down by 1
  21.     mov cx,160
  22.     mul cx            ; multiply by 160
  23.     mov si,[bp+8]        ; get column
  24.     mov bx,[si]        ; in bx
  25.     dec bx            ; down by 1
  26.     sal bx,1        ; multiply by 2
  27.     add ax,bx        ; got location
  28.     mov di,ax
  29.     mov ax,0        ; check monitor type
  30.     mov es,ax
  31.     mov ax,es:[410h]    ; get config byte
  32.     and al,30h        ; isolate monitor type
  33.     cmp al,30h        ; color?
  34.     jnz p010        ; yes
  35.     mov ax,0b000h        ; mono screen address
  36.     jmp p020
  37. p010:    mov ax,0b800h        ; color screen address
  38.  
  39. p020:    mov dx,es:[463h]    ; point to 6845 base port
  40.     add dx,6        ; point to status port
  41.  
  42.     mov es,ax        ; point to monitor
  43.     mov si,[bp+6]        ; get color attribute
  44.     mov bh,[si]        ; in bh
  45.     mov si,[bp+12]        ; point to lin$
  46.     mov cx,[si]        ; length in cx - up to 2000
  47.     jcxz p060        ; quit if string length is zero
  48.     add si,skip        ; addr of string
  49.     mov si,[si]
  50.     cld
  51.  
  52. p030:    mov bl,[si]        ; get next character
  53.  
  54. p040:    in al,dx        ; get crt status
  55.     test al,1        ; is it low?
  56.     jnz p040        ; no - wait
  57.     cli            ; no interrupts
  58.  
  59. p050:    in al,dx        ; get crt status
  60.     test al,1        ; is it high?
  61.     jz p050         ; no - wait
  62.  
  63.     mov ax,bx        ; move color & character
  64.     stosw            ; move color & character again
  65.     sti            ; interrupts back on
  66.     inc si            ; point to next character
  67.     loop p030        ; done?
  68.  
  69. p060:    pop es            ; restore es
  70.     pop bp            ; return to caller
  71.     ret 8
  72.  
  73. scrsub    endp
  74. cseg    ends
  75.     end
  76.